﻿using QD.Utill;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

using System.Windows.Forms;

namespace QD.Snapshot.Test
{
    public partial class TestSoGou : Form
    {
        public TestSoGou()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {


        }

        private void button1_Click(object sender, EventArgs e)
        {
            TestSogou();
        }


        void TestSogou()
        {
            //textBox2.Text = "7ACC77562722A5D0BD67B615271E9C18";
            //textBox3.Text = "0060386D7151EA5D5C88D039D5BA1054";

            var url = string.Format("http://www.sogou.com/web?query={0}&_asf=www.sogou.com&_ast=1301755099&w=01019900&p=40040100", "汉中围挡");

            HttpRequest Http = new HttpRequest();
            Http.ClearCookie();
            Http.AddCookie("SNUID", textBox2.Text.Trim(), ".sogou.com", DateTime.Now.AddDays(180));
            Http.AddCookie("SUV", textBox3.Text.Trim(), ".sogou.com", DateTime.Now.AddDays(180));
            Http.Referer = "https://m.sogou.com/";
            Http.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
            var html = Http.Requset(url);

            textBox1.Text = string.Format("长度：{0}\r\n\r\n匹配：{1}\r\n\r\n {2}", html.Length,
                html.Contains("验证码") ? "验证码" : "成功",
                html);
            //  Clipboard.SetDataObject(textBox1.Text);
        }
    }   

}
